package fun.easycode.jointblock.core;

import fun.easycode.jointblock.exception.CheckException;
import org.springframework.util.StringUtils;

/**
 * 微服务UserHolder实例
 * @author xuzhe
 */
public class CloudUserHolder extends UserHolder{
    @Override
    public String getUserId() {
        String currUserId = RequestHolder.getRequest().getHeader("x-currUserId");
        if(StringUtils.isEmpty(currUserId)){
            throw new CheckException("x-currUserId header未传入！");
        }
        return currUserId;
    }
}
